
public class StateManager {
	State currentState = null;
	Application app;
	public StateManager(Application application){
		app = application;
	}
	public void changeState(State state) {
		if (currentState != null) {
			//currentState.setThreadRun(false);
			app.getContentPane().remove(currentState);
		}
		currentState = state;
		//currentState.setThreadRun(true);
		app.getContentPane().add(currentState);
		currentState.setFocusable(true);
		currentState.requestFocusInWindow();
		app.validate();
	}
	public State getCurrentState(){
		return currentState;
	}
}
